<template>
  <div>
    <van-row type="flex" align="center">
      <van-col span="20">
        <!-- 输入框 -->
        <van-field
          v-model="title"
          rows="2"
          autosize
          label="留言"
          type="textarea"
          maxlength="20"
          placeholder="请发誓"
          show-word-limit
          @keyup.enter="addPut"
        />
      </van-col>
      <van-col span="4">
        <van-button @click="addPut">提交</van-button>
      </van-col>
    </van-row>
  </div>
</template>

<script>
export default {
  name: "",
  props: [],
  //注册组件
  components: {},
  data() {
    return {
        title:''
    };
  },
  // 在实例创建完成后被立即调用最早开始使用 data和methods中数据的钩子
  created() {},
  //挂载完成，HTML已经被渲染到了页面上，这个阶段可以执行dom操作，可以进行数据请求
  mounted() {},
  //方法
  methods: {
      addPut(){
          this.$emit('addPut',this.title)
          this.title = ''
      }
  },
  //计算属性
  computed: {},
  //监听器
  watch: {},
  //自定义指令
  directives: {},
};
</script>

<style lang="scss" scoped></style>
